package com.hyst.seviceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.hyst.domain.Student;
import com.hyst.domain.StudentView;
import com.hyst.repository.StudentMapper;
import com.hyst.service.TryListenService;
import com.hyst.utils.UuidTool;

@Service
public class TryListenServiceImpl implements TryListenService {

	@Autowired
	private StudentMapper mapper;
	
	@Override
	public Page<StudentView> listview(StudentView studentView) {
		final Page<StudentView> page = PageHelper.startPage(studentView.getPageNum(), studentView.getPageSize());
		mapper.getTryListenStudent();
		return page;
	}

	@Override
	public Student insert(final Student student) {
		student.setStudentId(UuidTool.randomUUID());
		mapper.insertSelective(student);
		return student;
	}

	@Override
	public Student getByPriKey(final String studentId) {
		final Student student = mapper.selectByPrimaryKey(studentId);
		return student;
	}

	@Override
	public Student updateSelective(final Student student) {
		mapper.updateByPrimaryKeySelective(student);
		return student;
	}

	@Override
	public Student update(final Student student) {
		mapper.updateByPrimaryKey(student);
		return student;
	}

	@Override
	public Student delete(final String studentId) {

		return null;
	}

	@Override
	public Page<Student> list(Student student) {
		// TODO Auto-generated method stub
		return null;
	}

}
